home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
sgiCD
/
cdinfo.c
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
2KB
|
63 lines
#include <stdio.h>
#include <sys/types.h>
#include <cdaudio.h>
main (argc, argv)
int argc;
char *argv[];
{
CDPLAYER *cd;
CDSTATUS status;
CDTRACKINFO info;
int track;
fputs ("CDinfo V1.0\n", stdout);
cd = CDopen(0, "r");
if (cd == NULL) {
perror ("CDopen failed");
exit (1);
}
/* show info about the entire disk */
if (CDgetstatus(cd, &status) == 0) {
perror ("CDgetstatus failed");
CDclose(cd);
exit (1);
}
if (status.state != CD_READY) {
fputs ("The CD player is not ready\n", stderr);
CDclose(cd);
exit (1);
}
printf ("The CD drive is Ready. This drive %s support reading audio data over the SCSI bus\n",
(status.scsi_audio ? "does" : "DOES NOT"));
printf ("First track = %d, Last track = %d, Total time on disk = %02d:%02d\n\n",
status.first, status.last, status.total_min, status.total_sec);
#ifdef NOTDEF
/*
* since the current position changed as soon as we called CDgetstatus(),
* there's not much point in telling the user where we were.
*/
printf ("Current position is at track %d, timecode %02d:%02d, frame %d\n",
status.track, status.min, status.sec, status.frame);
printf ("Current posision relative to beginning of disk is %02d:%02d, frame %d\n\n",
status.abs_min, status.abs_sec, status.abs_frame);
#endif /* NOTDEF */
/* show info about each track */
for (track = status.first; track <= status.last; track++) {
if (CDgettrackinfo(cd, track, &info) == 0) {
perror ("CDgettrackinfo failed");
break;
}
printf ("\tTrack %2d: Length %02d:%02d\n", track, info.total_min, info.total_sec);
}
fputc ('\n', stdout);
CDclose(cd);
exit (0);
}